program tester

    use, intrinsic :: iso_fortran_env, only: error_unit
    use testdrive, only: run_testsuite, new_testsuite, testsuite_type
    use test_sph_load_lua, only: collect_load_lua
    use test_sph_meson
    use test_sph_load_rigid
    integer stat, is
    type(testsuite_type), allocatable :: test_suites(:)
    character(*), parameter :: fmt = "('#', *(1x, a))"

    call env%ensure_env()
    call env%setup_path()
    stat = 0
    test_suites = [ &
                  new_testsuite("mod: test_sph_load_lua", collect_load_lua), &
                  new_testsuite("mod: test_sph_load_rigid", collect_load_rigid) &
                  ]

    do is = 1, size(test_suites)
        write (error_unit, fmt) "Testing:", test_suites(is)%name
        call run_testsuite(test_suites(is)%collect, error_unit, stat)
    end do

    if (stat > 0) then
        write (error_unit, '(i0, 1x, a)') stat, "test(s) failed!"
        error stop
    end if

end program tester
